<?php
/**
 * 商户后台--资金流水控制器
 * @author 孙银川
 * @date   2017.12.31
 */
namespace app\index\controller;

use think\facade\Session;
use app\common\model\MoneyWater as MwModel;

class MoneyWater extends Base{

	/**
     * 流水列表
     */
	public function moneyList(){
		// 商户ID
        $shop_id = Session::get('sp_id','index');
        if(!$shop_id) $this->error('请先登录','index/login');
		// 查询条件
		$map['m.mw_label'] = ['m.mw_label','=',2];
		$map['m.mw_shop_id'] = ['m.mw_shop_id','=',$shop_id];
		$mw = new MwModel();
		$money_list = $mw->enquiries(10,$map);

		$this->assign('page',$money_list->page);
		$this->assign('count',$money_list->count);
		$this->assign('money_list',$money_list->items());
		return $this->fetch('moneywater/moneyList');
	}

	/**
     * 流水详情
     */
	public function moneyDetail(){
		$id = input('get.id');
		$mw = new MwModel();
		if($id) $money = $mw->detail($id);

		$this->assign('money',$money);
		return $this->fetch('moneywater/moneyDetail');
	}
}